#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

bool _416(vector<int> nums)
{
    int M = nums.size();
    int N = accumulate(nums.begin(), nums.end(), 0) / 2;
    vector<vector<bool>> dp(M + 1, vector<bool>(N + 1, false));
    for (int i = 0; i <= M; i++)
    {
        dp[i][0]=true;
    }
    
    for (int i = 1; i <= M; i++)
    {
        int num = nums[i-1];
        for (int j = num; j <= N; j++)
        {
            dp[i][j] = dp[i - 1][j] || dp[i - 1][j - nums[i - 1]];
        }
    }
    return dp[M][N];
}

int main()
{
    cout << boolalpha << _416(vector<int>{1, 5, 11, 5}) << endl;
    return 0;
}